{include file="public/top" /}
<link href="__ADMIN__css/jquery.taghandler.css" rel="stylesheet" />
<script src="__ADMIN__js/jquery.taghandler.js"></script>

<style>
    .layui-field-title{margin-top: 20px}
    .parameter-mm{min-height: 100px;width: 45%;}
    .product-img-list{height: 90px;width: 90%}
    .product-img{height: 80px;width: 120px;margin: 0 10px 0 0;cursor:pointer;}
    .layui-collapse{border-width: 0;}
    .parameter-title{width: 100%;height: 40px;}
    .parameter-title span{width: 100px;height: 35px;background: #c2c2c2;display: inline-block;text-align: center;line-height: 35px;color: white}
    .parameter-mm-table{background: #fefefe;min-height: 100px;border-radius: 3px}
    .coo-btn{min-width: 100px;width:auto;padding-left:5px;padding-right:5px;height: 35px;border-radius: 3px;cursor: pointer;color: #fefefe;border: none;display: inline-block;margin-top: 10px}
    .coo-btn-df{background: #ededed  !important;color: #222222}
    .coo-btn-df:hover{background: #e0e0e0 !important;color: #0C0C0C}
    .coo-btn-blue{background: #428bca !important;color: white}
    .coo-btn-blue:hover{background: #1d6fa6 !important;color: white}
    .parameter-mm-table, .parameter-mm-table-th, .parameter-mm-table-td {border: 1px solid #cccccc;text-align: center;border-radius: 10px}
    .parameter-mm-table-th, .parameter-mm-table-td{height: 40px}
    .coo-input{height: 32px;border-radius: 3px;border: 1px solid #cccccc;padding-left: 5px}
    .coo-input:hover{border: 1px solid #428bca;padding-left: 5px}
    .parts-li{float: left;margin-top: 30px}
    .parts-li-img{height: 110px;width: 150px;margin: 0 20px 0 0;}
    .parts-li-img:hover {opacity: 0.4;cursor: pointer;}
    .parts-li-span{float: left;background: white;cursor:pointer;color: red;border-radius: 2px;font-weight: bold;width: 17px;position: relative;margin-right: -30px;margin-top: -109px;margin-left: 1px;}
    .parts-li-select-span{float: left;cursor:pointer;position: relative;margin-right: -30px;margin-top: -119px;margin-left: 1px;}
    .parts-li-div{word-break: break-all;white-space: pre-wrap;width: 150px;overflow:hidden;height:75px;}
    .layui-colla-titles {position: relative;height: 42px;line-height: 42px;padding: 0 15px 0 10px;color: #333;background-color: #f2f2f2;cursor: pointer;font-size: 14px;overflow: hidden;}

    .img-spans-box{position:relative; margin:20px auto;width:130px;height:90px;display: inline-block;}
    .img-shadow-box{position: absolute;height: 80px;width: 120px;cursor: pointer;float: left;}
    .img-shadow-span{position: absolute;height: 80px;width: 120px;z-index: 99;float: left;background: #111;opacity: 0.2;display: inline-block;top: 0;border: 1px solid white;}
    .img-shadow-box:hover  .img-shadow-box-son{display: block;}
    .img-shadow-box-son{display: none}
    .img-shadow-icon{display: flex;justify-content:center;align-items:Center;margin: 0 auto;}
    .img-shadow-icon span{margin-top: 25px;font-weight: 600;}
    .img-shadow-icon span i{font-size: 30px;color: red;z-index: 100;}


    .product-img-spans-box{position:relative; margin:20px auto;height: 95px;width: 165px;display: inline-block;}
    .product-img-shadow-box{position: absolute;height: 110px;width:150px;cursor: pointer;float: left;}
    .product-img-shadow-span{position: absolute;height: 110px;width:150px;z-index: 99;float: left;background: #111;opacity: 0.2;display: inline-block;top: 0;border: 2px solid white;border-radius: 5px}
    .product-img-shadow-box:hover  .product-img-shadow-son{display: block;}
    .product-img-shadow-son{display: none;}

    .product-img-shadow-icon{display: flex;justify-content:center;align-items:Center;margin: 0 auto;}
    .product-img-shadow-icon span{margin-top: 30px;font-weight: 600;}
    .product-img-shadow-icon span i{font-size: 30px;color: red;z-index: 100;}

    .product-img-shadow-icon-select{display: flex;justify-content:center;align-items:Center;margin: 0 auto;}
    .product-img-shadow-icon-select span{margin-top: 30px;font-weight: 600;}
    .product-img-shadow-icon-select span i{font-size: 30px;color:#4cff22;z-index: 100;}
    .display-block{display: block}
</style>
<body>
<div class="x-body" id="example">
    <form class="layui-form" method="post" onsubmit="return false">
        <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
            <legend>应用分类</legend>
        </fieldset>
        <div class="video-box">
            <div class="layui-form-item" style="margin-left: 30px;width: 90%;">
                <span style="display:inline-block;width: 30%;">
                    <select id="type1" name="type1" class="valid" >
                        <option value="0">--请选择 Material 分类--</option>
                        <?php foreach($app_type_list as $val):?>
                        <?php if($val['type'] == 1):?>
                        <option value="<?php echo $val['id'];?>" <?php if($val['id'] == $data['type1']):?>selected=''<?php endif;?>><?php echo $val['name'];?></option>
                        <?php endif;?>
                        <?php endforeach;?>
                    </select>
                </span>
                <span style="display:inline-block;width: 30%;">
                    <select id="type2" name="type2" class="valid" style="width: 30%;">
                        <option value="0">--请选择 Industry 分类--</option>
                        <?php foreach($app_type_list as $val):?>
                        <?php if($val['type'] == 2):?>
                        <option value="<?php echo $val['id'];?>" <?php if($val['id'] == $data['type2']):?>selected=''<?php endif;?>><?php echo $val['name'];?></option>
                        <?php endif;?>
                        <?php endforeach;?>
                    </select>
                </span>
                <span style="display:inline-block;width: 30%;">
                    <select id="type3" name="type3" class="valid" style="width: 30%;">
                        <option value="0">--请选择 Processing 分类--</option>
                        <?php foreach($app_type_list as $val):?>
                        <?php if($val['type'] == 3):?>
                        <option value="<?php echo $val['id'];?>" <?php if($val['id'] == $data['type3']):?>selected=''<?php endif;?>><?php echo $val['name'];?></option>
                        <?php endif;?>
                        <?php endforeach;?>
                    </select>
                </span>

            </div>
        </div>

        <!--应用名称-->
        <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
            <legend>应用名称</legend>
        </fieldset>
        <div class="video-box">
            <div class="layui-form-item" style="margin-left: 30px;width: 90%;">
                <div class="video-input" style="width: 60%;">
                    <input type="text" class="coo-input" name="name" style="width: 100%;" placeholder="输入应用名称" value="<?php echo $data['name'];?>">
                </div>
            </div>
        </div>

        <!--应用标题-->
        <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
            <legend>应用标题</legend>
        </fieldset>
        <div class="video-box">
            <div class="layui-form-item" style="margin-left: 30px;width: 90%;">
                <div class="video-input" style="width: 60%;">
                    <input type="text" class="coo-input" name="title" style="width: 100%;" placeholder="输入应用标题" value="<?php echo $data['title'];?>">
                </div>
            </div>
        </div>

        <!--应用标题-->
        <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
            <legend>应用关键字</legend>
        </fieldset>
        <div class="video-box">
            <div class="layui-form-item" style="margin-left: 30px;width: 90%;">
                <div class="video-input" style="width: 60%;">
                    <input type="text" class="coo-input" name="keyword" style="width: 100%;" placeholder="输入应用关键字" value="<?php echo $data['keyword'];?>">
                </div>
            </div>
        </div>

        <!--应用描述-->
        <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
            <legend>应用描述</legend>
        </fieldset>
        <div class="layui-form-item" style="margin-left: 30px;width: 90%"><!--style="height:360px"-->
            <textarea placeholder="输入应用描述" id="describe" name="describe" class="layui-textarea"><?php echo $data['describe'];?></textarea>
        </div>

        <!--应用排序-->
        <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
            <legend>应用排序</legend>
        </fieldset>
        <div class="video-box">
            <div class="layui-form-item" style="margin-left: 30px;width: 90%;">
                <div class="video-input" style="width: 60%;">
                    <input type="text" class="coo-input" name="sort" style="width: 100%;" placeholder="输入应用排序" value="<?php echo $data['sort'];?>">
                </div>
            </div>
        </div>

        <!--应用图片-->
        <fieldset class="layui-elem-field layui-field-title">
            <legend>应用封面</legend>
        </fieldset>
        <div class="layui-form-item" style="margin-left: 30px">
            <div class="product-img-list">
                <span id="application_cover_box">
                    <?php if($data['cover_url']):?>
                        <span onclick="_removeThis(this)" title="点击删除图片" class="img-spans-box">
                                <div class="img-shadow-box">
                                    <div class="img-shadow-box-son">
                                        <div class="img-shadow-icon">
                                            <span><i class="icon iconfont"></i></span>
                                        </div>
                                        <span class="img-shadow-span"></span>
                                    </div>
                                </div>
                                <img class="product-img" src="<?php echo $data['cover_url'];?>">
                                <input type="hidden" name="application_cover" value="<?php echo $data['cover_url'];?>">
                        </span>
                    <?php endif;?>
                </span>
                <label for="application_cover_button" style="clear: both">
                    <img class="product-img" src="__ADMIN__images/addLogo_box.png">
                </label>
                <span style="display: inline-block;">图片尺寸 1000 * 1600 支持 png，jpg格式</span>
            </div>

            <button type="button" style="margin: 5px 0 0 0;display: none" class="layui-btn layui-btn-small" id="application_cover_button">
                <i class="layui-icon">&#xe67c;</i>上传图片
            </button>

        </div>

        <!--应用图片-->
        <fieldset class="layui-elem-field layui-field-title">
            <legend>应用图片</legend>
        </fieldset>
        <div class="layui-form-item" style="margin-left: 30px">
            <div class="product-img-list">
                <span id="application_img_box">
                    <?php if($data['img_url_arr']):?>
                        <?php foreach($data['img_url_arr'] as $val):?>
                            <span onclick="_removeThis(this)" title="点击删除图片" class="img-spans-box">
                                <div class="img-shadow-box">
                                    <div class="img-shadow-box-son">
                                        <div class="img-shadow-icon">
                                            <span><i class="icon iconfont"></i></span>
                                        </div>
                                        <span class="img-shadow-span"></span>
                                    </div>
                                </div>
                                <img class="product-img" src="<?php echo $val;?>">
                                <input type="hidden" name="application_img[]" value="<?php echo $val;?>">
                            </span>
                        <?php endforeach;?>
                    <?php endif;?>
                </span>
                <label for="application_img_button" style="clear: both">
                    <img class="product-img" src="__ADMIN__images/addLogo_box.png">
                </label>
                <span style="display: inline-block;">图片尺寸 1000 * 1600 支持 png，jpg格式</span>
            </div>

            <button type="button" style="margin: 5px 0 0 0;display: none" class="layui-btn layui-btn-small" id="application_img_button">
                <i class="layui-icon">&#xe67c;</i>上传图片
            </button>

        </div>

        <!--应用排序-->
        <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
            <legend>应用图片Alt</legend>
        </fieldset>
        <div class="video-box">
            <div class="layui-form-item" style="margin-left: 30px;width: 90%;">
                <div class="video-input" style="width: 60%;">
                    <input type="text" class="coo-input" name="alt" style="width: 100%;" placeholder="输入应用图片Alt" value="<?php echo $data['alt'];?>">
                </div>
            </div>
        </div>


        <!--应用介绍-->
        <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
            <legend>应用介绍</legend>
        </fieldset>
        <div class="layui-form-item" style="margin-left: 30px;width: 90%"><!--style="height:360px"-->
            <script type="text/plain" id="introduce" name="introduce" class="ueueueues"><?php echo $data['introduce'];?></script>
        </div>

        <!--应用介绍-->
        <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
            <legend>应用适合场景</legend>
        </fieldset>
        <div class="layui-form-item" style="margin-left: 30px;width: 90%">
            <ul class="tags scene_tags"></ul>
            <span style="display: inline-block;margin-bottom: 20px">输入应用适合场景标签，回车确认</span>
            <div class="product-img-list">
                <span id="application_scene_img_box">
                    <?php if($data['scene_img_arr']):?>
                        <?php foreach($data['scene_img_arr'] as $val):?>
                            <span onclick="_removeThis(this)" title="点击删除图片" class="img-spans-box">
                                <div class="img-shadow-box">
                                    <div class="img-shadow-box-son">
                                        <div class="img-shadow-icon">
                                            <span><i class="icon iconfont"></i></span>
                                        </div>
                                        <span class="img-shadow-span"></span>
                                    </div>
                                </div>
                                <img class="product-img" src="<?php echo $val;?>">
                                <input type="hidden" name="scene_img[]" value="<?php echo $val;?>">
                            </span>
                        <?php endforeach;?>
                    <?php endif;?>
                </span>
                <label for="application_scene_img_button" style="clear: both">
                    <img class="product-img" src="__ADMIN__images/addLogo_box.png">
                </label>
                <span style="display: inline-block;">图片尺寸 1000 * 1600 支持 png，jpg格式</span>
            </div>
            <button type="button" style="margin: 5px 0 0 0;display: none" class="layui-btn layui-btn-small" id="application_scene_img_button">
                <i class="layui-icon">&#xe67c;</i>上传图片
            </button>
        </div>

        <!--应用介绍-->
        <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
            <legend>产品标明</legend>
        </fieldset>
        <div class="layui-form-item" style="margin-left: 30px;width: 90%">
            <div style="width: 48%;float: left">
                <input type="text" class="coo-input" name="mark_one_title" style="width: 100%;" placeholder="输入产品标明标题" value="<?php echo $data['mark_one_arr']['title'];?>">
                <ul class="tags mark_tags"></ul><span style="display: inline-block;margin-bottom: 20px">输入产品标明标签，回车确认</span>
                <div class="product-img-list">
                    <span id="application_mark_img_box">
                        <?php if($data['mark_one_arr']['img_url']):?>
                            <span onclick="_removeThis(this)" title="点击删除图片" class="img-spans-box">
                                <div class="img-shadow-box">
                                    <div class="img-shadow-box-son">
                                        <div class="img-shadow-icon">
                                            <span><i class="icon iconfont"></i></span>
                                        </div>
                                        <span class="img-shadow-span"></span>
                                    </div>
                                </div>
                                <img class="product-img" src="<?php echo @$data['mark_one_arr']['img_url'];?>">
                                <input type="hidden" name="mark_one_img" value="<?php echo @$data['mark_one_arr']['img_url'];?>">
                            </span>
                        <?php endif;?>
                    </span>
                    <label for="application_mark_img_button" style="clear: both">
                        <img class="product-img" src="__ADMIN__images/addLogo_box.png">
                    </label>
                    <span style="display: inline-block;">图片尺寸 1000 * 1600 支持 png，jpg格式</span>
                </div>
                <button type="button" style="margin: 5px 0 0 0;display: none" class="layui-btn layui-btn-small" id="application_mark_img_button">
                    <i class="layui-icon">&#xe67c;</i>上传图片
                </button>
            </div>

            <div style="width: 48%;float: right">
                <input type="text" class="coo-input" name="mark_two_title" style="width: 100%;" placeholder="输入产品标明标题" value="<?php echo $data['mark_two_arr']['title'];?>">
                <ul class="tags mark_two_tags"></ul><span style="display: inline-block;margin-bottom: 20px">输入产品标明标签，回车确认</span>
                <div class="product-img-list">
                    <span id="application_mark_img_two_box">
                        <?php if($data['mark_two_arr']['img_url']):?>
                            <span onclick="_removeThis(this)" title="点击删除图片" class="img-spans-box">
                                <div class="img-shadow-box">
                                    <div class="img-shadow-box-son">
                                        <div class="img-shadow-icon">
                                            <span><i class="icon iconfont"></i></span>
                                        </div>
                                        <span class="img-shadow-span"></span>
                                    </div>
                                </div>
                                <img class="product-img" src="<?php echo $data['mark_two_arr']['img_url'];?>">
                                <input type="hidden" name="mark_two_img" value="<?php echo $data['mark_two_arr']['img_url'];?>">
                            </span>
                        <?php endif;?>
                    </span>
                    <label for="application_mark_img_two_button" style="clear: both">
                        <img class="product-img" src="__ADMIN__images/addLogo_box.png">
                    </label>
                    <span style="display: inline-block;">图片尺寸 1000 * 1600 支持 png，jpg格式</span>
                </div>
                <button type="button" style="margin: 5px 0 0 0;display: none" class="layui-btn layui-btn-small" id="application_mark_img_two_button">
                    <i class="layui-icon">&#xe67c;</i>上传图片
                </button>
            </div>


        </div>

        <!--应用视频-->
        <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
            <legend>应用视频</legend>
        </fieldset>
        <div class="video-box">
            <div class="layui-form-item" style="margin-left: 30px;width: 90%;">
                <div class="video-input" style="width: 60%;">
                    <input type="text" class="coo-input" style="width: 100%;" name="product_video_url" placeholder="输入视频地址链接" value="<?php echo $data['video'];?>">
                </div>
            </div>
        </div>

        <!--应用描述-->
        <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
            <legend>应用描述</legend>
        </fieldset>
        <div class="layui-form-item" style="margin-left: 30px;width: 90%"><!--style="height:360px"-->
            <script type="text/plain" id="describe1" name="describe1" class="ueueueues"><?php echo $data['describe1'];?></script>
        </div>



        <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
            <legend>应用样品</legend>
        </fieldset>
        <div class="layui-form-item" style="margin-left: 30px;width: 90%;">
            <ul class="select_sample_ul">
                <?php if($data['sample_ids_arr']):?>
                    <?php foreach($data['sample_ids_arr'] as $val):?>
                        <li class="parts-li">
                            <div class="product-img-spans-box" onclick="_removeSelectElement(this)" data-id="<?php echo $val['id'];?>" data-element="sample">
                                <div class="product-img-shadow-box">
                                    <div class="product-img-shadow-son ">
                                        <div class="product-img-shadow-icon">
                                            <span style="margin-top: 45px;"><i class="icon iconfont"></i></span>
                                        </div>
                                        <span class="product-img-shadow-span" ></span>
                                    </div>
                                </div>
                                <img  class="parts-li-img" src="<?php echo $val['img_url'];?>">
                            </div>
                            <div class="parts-li-div"><?php echo $val['name'];?></div>
                            <input type="hidden" name="sample_input[]" value="<?php echo $val['id'];?>" class="sample_input">
                        </li>
                    <?php endforeach;?>
                <?php endif;?>
            </ul>
        </div>
        <div class="layui-form-item" style="margin-left: 30px;width: 90%;min-height: 120px;height: auto">
            <div class="layui-collapse" lay-accordion>
                <div class="layui-colla-item">
                    <h2 class="layui-colla-title">选择样品</h2>
                    <div class="layui-colla-content layui-show" style="clear: both">
                        <?php foreach($sample_type_list as $val):?>
                            <button class="coo-btn coo-btn-df sample-category" type="button" data-id="<?php echo $val['id'];?>"><?php echo $val['name'];?></button>
                        <?php endforeach;?>
                        <div style="margin-top: 20px;clear: both;">
                            <ul class="set_sample_ul"></ul>
                        </div>

                        <input type="hidden" id="sample_page" value="1">
                        <input type="hidden" id="sample_category" value="0">
                    </div>
                </div>
            </div>
        </div>

        <!--产品图片-->
        <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
            <legend>注意事项</legend>
        </fieldset>
        <div class="layui-form-item" style="margin-left: 30px;width: 90%">
            <script type="text/plain" id="significance" class="ueueueues"><?php echo $data['significance'];?></script>
            <div class="product-img-list" style="margin-top: 20px">
                <span id="application_significance_box">
                    <?php if($data['significance_img']):?>
                        <span onclick="_removeThis(this)" title="点击删除图片" class="img-spans-box">
                            <div class="img-shadow-box">
                                <div class="img-shadow-box-son">
                                    <div class="img-shadow-icon">
                                        <span><i class="icon iconfont"></i></span>
                                    </div>
                                    <span class="img-shadow-span"></span>
                                </div>
                            </div>
                            <img class="product-img" src="<?php echo @$data['significance_img'];?>">
                            <input type="hidden" name="significance_img" value="<?php echo @$data['significance_img'];?>">
                        </span>
                    <?php endif;?>
                </span>
                <label class="parameters-box" for="application_significance_button" style="clear: both">
                    <img style="height: 80px;width: 120px;margin: 0 10px 0 0;cursor:pointer;" src="__ADMIN__images/addLogo_box.png">
                </label>
                <span style="display: inline-block;">图片尺寸 1000 * 1600 支持 png，jpg格式</span>
            </div>

            <button type="button" style="margin: 5px 0 0 0;display: none" class="layui-btn layui-btn-small" id="application_significance_button">
                <i class="layui-icon">&#xe67c;</i>上传图片
            </button>
        </div>

        <!--作用与优势-->
        <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
            <legend>作用与优势</legend>
        </fieldset>
        <div class="layui-form-item" style="margin-left: 30px;width: 90%;">
            <ul class="select_advantage_ul">
                <?php if($data['advantage_arr']):?>
                    <?php foreach($advantage_type_list as $val):?>
                        <?php if(in_array($val['id'], $data['advantage_arr'])):?>
                            <span style='margin-left: 10px;margin-top: 10px;display: inline-block' onclick='_removeAdvantage(this)' title='点击删除当前作用与优势' data-id="<?php echo $val['id'];?>">
                                <button class='coo-btn coo-btn-df advantage_category_s' type='button'><?php echo $val['name'];?></button>
                                <input type='hidden' name='advantage_input[]' value="<?php echo $val['id'];?>">
                            </span>
                        <?php endif;?>
                    <?php endforeach;?>
                <?php endif;?>
            </ul>
        </div>
        <div class="layui-form-item" style="margin-left: 30px;width: 90%;min-height: 120px;height: auto">
            <div class="layui-collapse" lay-accordion>
                <div class="layui-colla-item">
                    <h2 class="layui-colla-title">选择作用与优势</h2>
                    <div class="layui-colla-content layui-show" style="clear: both">
                        <?php foreach($advantage_type_list as $val):?>
                            <button class="coo-btn coo-btn-df advantage_category <?php if($data['advantage_arr'] && in_array($val['id'], $data['advantage_arr'])):?>coo-btn-blue<?php endif;?>" type="button" data-id="<?php echo $val['id'];?>" title='点击选择当前作用与优势' id="advantage_button_<?php echo $val['id'];?>"><?php echo $val['name'];?></button>
                        <?php endforeach;?>
                    </div>
                </div>
            </div>
        </div>


        <!--产品推荐-->
        <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
            <legend>产品推荐</legend>
        </fieldset>
        <div class="layui-form-item" style="margin-left: 30px;width: 90%;">
            <ul class="select_product_ul">
                <?php if($data['product_ids_arr']):?>
                    <?php foreach($data['product_ids_arr'] as $val):?>
                        <li class="parts-li">
                            <div class="product-img-spans-box" onclick="_removeSelectElement(this)" data-id="<?php echo $val['id'];?>" data-element="product">
                                <div class="product-img-shadow-box">
                                    <div class="product-img-shadow-son ">
                                        <div class="product-img-shadow-icon">
                                            <span style="margin-top: 45px;"><i class="icon iconfont"></i></span>
                                        </div>
                                        <span class="product-img-shadow-span" ></span>
                                    </div>
                                </div>
                                <img  class="parts-li-img" src="<?php echo @json_decode($val['img'], true)[0];?>">
                            </div>
                            <div class="parts-li-div"><?php echo $val['name'];?></div>
                            <input type="hidden" name="product_input[]" value="<?php echo $val['id'];?>" class="product_input">
                        </li>
                    <?php endforeach;?>
                <?php endif;?>
            </ul>
        </div>
        <div class="layui-form-item" style="margin-left: 30px;width: 90%;min-height: 120px;height: auto">
            <div class="layui-collapse" lay-accordion>
                <div class="layui-colla-item">
                    <h2 class="layui-colla-title">选择产品</h2>
                    <div class="layui-colla-content layui-show" style="clear: both">
                        <?php foreach($product_type_list as $val):?>
                            <button class="coo-btn coo-btn-df product-category" type="button" data-id="<?php echo $val['id'];?>"><?php echo $val['name'];?></button>
                        <?php endforeach;?>
                        <div style="margin-top: 20px;clear: both;">
                            <ul class="set_product_ul"></ul>
                        </div>

                        <input type="hidden" id="product_category" value="0">

                    </div>
                </div>
            </div>
        </div>

        <!--产品图片-->
        <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
            <legend>应用帮助</legend>
        </fieldset>
        <div class="layui-form-item" style="margin-left: 30px;width: 90%">
            <script type="text/plain" id="help" class="ueueueues"><?php echo $data['help'];?></script>
            <div class="product-img-list" style="margin-top: 20px">
                <span id="application_help_box">
                    <?php if($data['help_img']):?>
                    <span onclick="_removeThis(this)" title="点击删除图片" class="img-spans-box">
                            <div class="img-shadow-box">
                                <div class="img-shadow-box-son">
                                    <div class="img-shadow-icon">
                                        <span><i class="icon iconfont"></i></span>
                                    </div>
                                    <span class="img-shadow-span"></span>
                                </div>
                            </div>
                            <img class="product-img" src="<?php echo @$data['help_img'];?>">
                            <input type="hidden" name="help_img" value="<?php echo @$data['help_img'];?>">
                        </span>
                    <?php endif;?>
                </span>
                <label class="parameters-box" for="application_help_button" style="clear: both">
                    <img style="height: 80px;width: 120px;margin: 0 10px 0 0;cursor:pointer;" src="__ADMIN__images/addLogo_box.png">
                </label>
                <span style="display: inline-block;">图片尺寸 1000 * 1600 支持 png，jpg格式</span>
            </div>

            <button type="button" style="margin: 5px 0 0 0;display: none" class="layui-btn layui-btn-small" id="application_help_button">
                <i class="layui-icon">&#xe67c;</i>上传图片
            </button>
        </div>

        <!--应用详细介绍-->
        <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
            <legend>应用详细介绍</legend>
        </fieldset>
        <div class="layui-form-item" style="margin-left: 30px;width: 90%">
            <script type="text/plain" id="introduce1" class="ueueueues"><?php echo $data['introduce1'];?></script>
        </div>

        <hr class="layui-bg-gray">

        <div class="layui-form-item" style="clear: both">
            <label class="layui-form-label">
            </label>
            <button type="button"  class="layui-btn" lay-filter="add" lay-submit="">提交</button>
        </div>
        <input type="hidden" value="<?php echo $data['id'];?>" name="id">
    </form>
</div>
</body>


<script type="text/html" id="element_script_box">
    <li class="parts-li set_{{element}}_init" data-id="{{element_id}}">
        <div class="product-img-spans-box" onclick="_setPushSelectElement(this)" data-id="{{element_id}}" data-element="{{element}}">
            <div class="product-img-shadow-box">
                <div class="product-img-shadow-son {{checked}}">
                    <div class="product-img-shadow-icon-select">
                        <span style="margin-top: 45px;"><i class="icon iconfont"></i></span>
                    </div>
                    <span class="product-img-shadow-span" ></span>
                </div>
            </div>
            <img class="parts-li-img" src="{{img_url}}">
        </div>
        <div class="parts-li-div">{{element_name}}</div>
    </li>
</script>


<script type="text/html" id="element_select_script_box">
    <li class="parts-li">
        <div class="product-img-spans-box" onclick="_removeSelectElement(this)" data-id="{{element_id}}" data-element="{{element}}">
            <div class="product-img-shadow-box">
                <div class="product-img-shadow-son ">
                    <div class="product-img-shadow-icon">
                        <span style="margin-top: 45px;"><i class="icon iconfont"></i></span>
                    </div>
                    <span class="product-img-shadow-span" ></span>
                </div>
            </div>
            <img  class="parts-li-img" src="{{img_url}}">
        </div>
        <div class="parts-li-div">{{element_name}}</div>
        <input type="hidden" name="{{element}}_input[]" value="{{element_id}}" class="{{element}}_input">
    </li>
</script>


<script type="text/html" id="sample_list_script_box">
    <li class="parts-li set_sample_init" data-id="{{sample_id}}">
        <img class="parts-li-img" src="{{img_url}}" onclick="_setPushSelectSample(this)" data-id="{{sample_id}}">
        <span class="parts-li-select-span"><input type="checkbox" name="parts" title="" lay-skin="primary" disabled="" {{checked}}>
            <div class="layui-unselect layui-form-checkbox layui-checkbox-disbaled layui-disabled {{layui_checked}}" lay-skin="primary">
                <i class="layui-icon"></i></div></span>
        <div class="parts-li-div">{{sample_name}}</div>
    </li>
</script>
<script type="text/html" id="sample_script_box">
    <li class="parts-li">
        <img data-id="{{span_sample_id}}" class="parts-li-img" src="{{img_url}}" onclick="_removeSelectSample(this)">
        <span class="parts-li-span" ><i class="layui-icon layui-icon-close"></i></span>
        <div class="parts-li-div">{{sample_name}}</div>
        <input type="hidden" name="sample_input[]" value="{{sample_id}}" class="sample_input">
    </li>
</script>

<script type="text/html" id="product_list_script_box">
    <li class="parts-li set_product_init" data-id="{{product_id}}">
        <img class="parts-li-img" src="{{img_url}}" onclick="_setPushSelectProduct(this)" data-id="{{product_id}}">
        <span class="parts-li-select-span"><input type="checkbox" name="product" title="" lay-skin="primary" disabled="" {{checked}}>
            <div class="layui-unselect layui-form-checkbox layui-checkbox-disbaled layui-disabled {{layui_checked}}" lay-skin="primary">
                <i class="layui-icon"></i></div></span>
        <div class="parts-li-div">{{product_name}}</div>
    </li>
</script>
<script type="text/html" id="product_script_box">
    <li class="parts-li">
        <img data-id="{{span_product_id}}" class="parts-li-img" src="{{img_url}}" onclick="_removeSelectProduct(this)">
        <span class="parts-li-span" ><i class="layui-icon layui-icon-close"></i></span>
        <div class="parts-li-div">{{product_name}}</div>
        <input type="hidden" name="product_input[]" value="{{product_id}}" class="product_input">
    </li>
</script>
</html>

<script>
    var origtags = '';
    var newstags = origtags.split(',');
    var arr = new Array(); //将标签放入arr 数组中
    for (var i = 0; i < newstags.length; i++) {
        arr[i] = newstags[i];
    }
    jQuery(document).ready(function () {
        $('.scene_tags').tagHandler({
            assignedTags: <?php echo json_encode($data['scene_tags_arr']);?>, //原有标签,若没有，可以直接写 []
            availableTags: [],//用于自动补全的数据，可从后台获取
            autocomplete: true, //自动补全功能，true为有提示，false则反之
            onAdd: function (tag) {
                var addflag = true, tags = $(this).parent().parent().parent().find('.tagItem');
                $.each(tags, function () {
                    if ($(this).text() === tag) {
                        $(this).animate({ opacity: 0.21 }).delay(20).animate({ opacity: 1 }).animate({ opacity: 0.50 }).delay(20).animate({ opacity: 1 }).animate({ opacity: 0.75 }).delay(20).animate({ opacity: 1 });
                        addflag = false;
                    }
                });
                return addflag;
            },
            onDelete: function (tag) { //删除操作
                var addflag = false;
                var answer = confirm("您确定删除此标签？");
                if (answer) {
                    addflag = true;
                }
                return addflag;
            }
        });

        $('.mark_tags').tagHandler({
            assignedTags: <?php echo json_encode(explode(',', $data['mark_one_arr']['tags']));?>, //原有标签,若没有，可以直接写 []
        availableTags: [],//用于自动补全的数据，可从后台获取
            autocomplete: false, //自动补全功能，true为有提示，false则反之
            onAdd: function (tag) {
            var addflag = true, tags = $(this).parent().parent().parent().find('.tagItem');
            $.each(tags, function () {
                if ($(this).text() === tag) {
                    $(this).animate({ opacity: 0.21 }).delay(20).animate({ opacity: 1 }).animate({ opacity: 0.50 }).delay(20).animate({ opacity: 1 }).animate({ opacity: 0.75 }).delay(20).animate({ opacity: 1 });
                    addflag = false;
                }
            });
            return addflag;
        }
    ,
        onDelete: function (tag) { //删除操作
            var addflag = false;
            var answer = confirm("您确定删除此标签？");
            if (answer) {
                addflag = true;
            }
            return addflag;
        }
    });

        $('.mark_two_tags').tagHandler({
            assignedTags: <?php echo json_encode(explode(',', $data['mark_two_arr']['tags']));?>, //原有标签,若没有，可以直接写 []
        availableTags: [],//用于自动补全的数据，可从后台获取
            autocomplete: true, //自动补全功能，true为有提示，false则反之
            onAdd: function (tag) {
            var addflag = true, tags = $(this).parent().parent().parent().find('.tagItem');
            $.each(tags, function () {
                if ($(this).text() === tag) {
                    $(this).animate({ opacity: 0.21 }).delay(20).animate({ opacity: 1 }).animate({ opacity: 0.50 }).delay(20).animate({ opacity: 1 }).animate({ opacity: 0.75 }).delay(20).animate({ opacity: 1 });
                    addflag = false;
                }
            });
            return addflag;
        },
        onDelete: function (tag) { //删除操作
            var addflag = false;
            var answer = confirm("您确定删除此标签？");
            if (answer) {
                addflag = true;
            }
            return addflag;
        }
    });
    });

</script>

<script>
    var introduce = UE.getEditor('introduce');
    $("#introduce").css('height', '240px');

    var significance = UE.getEditor('significance');
    $("#significance").css('height', '240px');

    var describe1 = UE.getEditor('describe1');
    $("#describe1").css('height', '240px');

    /*应用帮助*/
    var help = UE.getEditor('help');
    $("#help").css('height', '240px');

    /*应用详细介绍*/
    var introduce1 = UE.getEditor('introduce1');
    $("#introduce1").css('height', '240px');


    var pushElement = function(element, data, select_arr){
        var html = $("#element_script_box").html();
        html = html.replace("{{element}}", element);
        html = html.replace("{{element}}", element);
        html = html.replace("{{img_url}}", data.img_url?data.img_url:data.img_url_site);
        html = html.replace("{{element_name}}", data.name);
        html = html.replace("{{element_id}}", data.id);
        html = html.replace("{{element_id}}", data.id);
        if($.inArray(data.id, select_arr) >= 0){
            html = html.replace("{{checked}}", 'display-block');
        } else {
            html = html.replace("{{checked}}", '');
        }
        return html;
    };

    var _setPushSelectElement = function (obj) {
        var img_url = $(obj).find('img').attr('src');
        var element = $(obj).data('element');
        var element_id = $(obj).data('id');
        var element_name = $(obj).parent().find('.parts-li-div').text();
        if($(obj).find(".product-img-shadow-son").hasClass("display-block")){
            layer.msg('当前数据已选择');
            return false;
        }
        $(obj).find(".product-img-shadow-son").addClass("display-block");
        var html = $("#element_select_script_box").html();
        html = html.replace("{{img_url}}", img_url);
        html = html.replace("{{element_name}}", element_name);
        html = html.replace("{{element}}", element);
        html = html.replace("{{element}}", element);
        html = html.replace("{{element}}", element);
        html = html.replace("{{element_id}}", element_id);
        html = html.replace("{{element_id}}", element_id);
        $(".select_"+element+"_ul").append(html);
    };

    var _removeSelectElement = function (obj) {
        var element = $(obj).data('element');
        var element_id = $(obj).data('id');
        layer.confirm('确认删除吗？', {
            btn : [ '确定', '取消' ]
        }, function(index) {
            var element_obj = $(".set_"+element+"_init[data-id="+element_id+"]");
            $(element_obj).find(".product-img-shadow-son").removeClass("display-block");
            $(obj).parent().remove();
            layer.msg('数据已删除');
        });
    };

    var _requestPost = function (obj, request_url, element, request_data) {
        if(!request_data){
            request_data = {category_id:$(obj).data('id'),type:3}
        }
        var element_obj = $(".set_"+element+"_ul");
        $.post(request_url, request_data,
            function(res) {
                if(res.code === 200 && res.data.length >= 1){
                    $(".set_"+element+"_ul").empty();
                    var element_input = $("."+element+"_input");
                    var element_input_arr = [];
                    $.each(element_input, function () {
                        element_input_arr.push(parseInt($(this).val()));
                    });

                    $.each(res.data, function (key, val) {
                        var html = pushElement(element, val, element_input_arr);

                        element_obj.append(html);
                    });
                }else {
                    element_obj.html('<span style="text-align: center;width: 100%;display: inline-block">暂无数据</span>');
                    return false;
                }
            }, 'json');
        $("."+element+"-category").removeClass('coo-btn-blue').addClass('coo-btn-df');
        $(obj).addClass('coo-btn-blue');
    };

    $(".advantage_category").click(function () {
        if($(this).hasClass('coo-btn-blue')){
            return false;
        }
        var adv_id = $(this).data('id');
        var adv_name = $(this).text();
        var html = "<span style='margin-left: 10px;margin-top: 10px;display: inline-block' onclick='_removeAdvantage(this)' title='点击删除当前作用与优势' data-id='"+adv_id+"'>" +
            "<button class='coo-btn coo-btn-df advantage_category' type='button'>"+adv_name+"</button>" +
            "<input type='hidden' name='advantage_input[]' value='"+adv_id+"'></span>";
        $(".select_advantage_ul").append(html);
        $(this).addClass('coo-btn-blue');
    });

    var _removeAdvantage = function (obj) {
        var adv_id = $(obj).attr('data-id');
        $("#advantage_button_"+adv_id).removeClass('coo-btn-blue').addClass('coo-btn-df');
        $(obj).remove();
    };

    $(".sample-category").click(function () {
        var category_id = $(this).data('id');
        _requestPost(this, '/admin/product/getSampleList', 'sample', {category_id:category_id});
    });
    _requestPost($(".sample-category").eq(0), '/admin/product/getSampleList', 'sample');


    $(".product-category").click(function () {
        var category_id = $(this).data('id');
        _requestPost(this, '/admin/application/getProductList', 'product', {category_id:category_id});
    });
    _requestPost($(".product-category").eq(0), '/admin/application/getProductList', 'product');

    var _removeThis = function (obj) {
        layer.confirm('确认删除图片吗？', {
            btn : [ '确定', '取消' ]
        }, function(index) {
            $(obj).remove();
            layer.msg('图片已删除');
        });
    };

    var img_script_box = function (value, key) {
        var img_script = '<span onclick="_removeThis(this)" title="点击删除图片" class="img-spans-box">' +
            '         <div class="img-shadow-box">' +
            '            <div class="img-shadow-box-son">' +
            '                <div class="img-shadow-icon">' +
            '                    <span><i class="icon iconfont"></i></span>' +
            '                </div>' +
            '                <span class="img-shadow-span"></span>' +
            '            </div>' +
            '        </div>' +
            '        <img class="product-img" src="'+value+'">' +
            '        <input type="hidden" name="'+key+'" value="'+value+'">' +
            '    </span>';
        layer.msg('上传成功');
        return img_script;

    };

    layui.use(['form','layer'], function(){
        $ = layui.jquery;
        var form = layui.form,layer = layui.layer;

        form.on('submit(add)', function(data){
           /* data.field.describe = describe.body.innerHTML;*/
            data.field.introduce = introduce.body.innerHTML;
            data.field.significance = significance.body.innerHTML;
            data.field.describe1 = describe1.body.innerHTML;
            data.field.help = help.body.innerHTML;
            data.field.introduce1 = introduce1.body.innerHTML;

            data.field.mark_two_tags = [];
            $.each($(".mark_two_tags").find('li'), function () {
                data.field.mark_two_tags.push($(this).text());
            });
            data.field.mark_tags = [];
            $.each($(".mark_tags").find('li'), function () {
                data.field.mark_tags.push($(this).text());
            });
            data.field.scene_tags = [];
            $.each($(".scene_tags").find('li'), function () {
                data.field.scene_tags.push($(this).text());
            });
            $.post('/admin/application/updateApplication', data.field, function(res) {
                if(res.code===200){
                    layer.msg('添加成功', {
                        time: 1000, //不自动关闭
                        icon:6,
                        end:function () {
                            location.href = '/admin/application/lists'
                        }
                    });
                    return false;
                }else {
                    layer.msg(res.msg)
                }


            });

        });

    });

    var imgupUrl = '/admin/index/imgUp';

    layui.use('upload', function(){
        var upload = layui.upload;

        upload.render({
            elem: '#application_cover_button'
            ,url: imgupUrl //上传接口
            ,done: function(res){
                var html = img_script_box(res.data, 'application_cover');
                $('#application_cover_box').append(html);
            },error: function(){
            }
        });

        upload.render({
            elem: '#application_img_button'
            ,url: imgupUrl //上传接口
            ,done: function(res){
                var html = img_script_box(res.data, 'application_img[]');
                $('#application_img_box').append(html);
            },error: function(){
            }
        });

        upload.render({
            elem: '#application_scene_img_button'
            ,url: imgupUrl //上传接口
            ,done: function(res){
                var html = img_script_box(res.data, 'scene_img[]');
                $('#application_scene_img_box').append(html);
            },error: function(){
                //请求异常回调
            }
        });

        upload.render({
            elem: '#application_mark_img_button'
            ,url: imgupUrl //上传接口
            ,done: function(res){
                var html = img_script_box(res.data, 'mark_one_img');
                $('#application_mark_img_box').html(html);
            },error: function(){
                //请求异常回调
            }
        });

        upload.render({
            elem: '#application_mark_img_two_button' //绑定元素
            ,url: imgupUrl //上传接口
            ,done: function(res){
                var html = img_script_box(res.data, 'mark_two_img');
                $('#application_mark_img_two_box').html(html);
            }
            ,error: function(){
                //请求异常回调
            }
        });

        upload.render({
            elem: '#application_significance_button' //绑定元素
            ,url: imgupUrl //上传接口
            ,done: function(res){
                var html = img_script_box(res.data, 'significance_img');
                $('#application_significance_box').html(html);
            }
            ,error: function(){
                //请求异常回调
            }
        });

        upload.render({
            elem: '#application_help_button' //绑定元素
            ,url: imgupUrl //上传接口
            ,done: function(res){
                var html = img_script_box(res.data, 'help_img');
                $('#application_help_box').html(html);
            }
            ,error: function(){
                //请求异常回调
            }
        });
    });
</script>